import { requestPost } from "@/api/data";
import { Message } from "element-ui";

const app = {
  state: {
    formData: null, // 表单设计预览存储内容
  },

  mutations: {
    SET_FORMDATA(state, formData) {
      state.formData = formData?.list.length ? formData : null
    }
  },
  actions: {
    login({ commit, state },) {
      return new Promise((resolve, reject) => {
        const formData = {
          cellphone: '18633083599',
          password: 'e10adc3949ba59abbe56e057f20f883e',
          code: 'sf',
          codeNumber: 0.21611088647354593,
        }
        requestPost('/ECS/sys/user/userLogin', formData)
          .then(() => {
            Message.success('登录成功')
          })
          .catch(() => {
            Message.error('登录失败')
          });

      })
    },
  }
}

export default app
